import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import Vant from  'vant'
import 'vant/lib/index.css';
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

createApp(App).use(router).use(Vant).use(ElementPlus).mount('#app')

// rem 适配，根据屏幕宽度设置根字体大小
function setRem() {
  const clientWidth = document.documentElement.clientWidth;
  if (clientWidth >= 750) {
    document.documentElement.style.fontSize = '100px'; // 或根据实际需求设置一个最大值
  } else {
    document.documentElement.style.fontSize = (clientWidth / 750) * 100 + 'px';
  }
}

// 页面加载和窗口大小时重新设置
setRem();
window.addEventListener('resize', setRem);
